package com.af.robot.result;

import com.alibaba.fastjson.JSONObject;

/**
 * @ClassName ResultEnum
 * @Description 相关错误码和信息
 * @Auth
 * @Date 2019/6/20 10:03
 * @Version 1.0
 **/
public enum ResultEnum {
    PATH_INVALID(300,"查询路径无效"),
    PATH_NO_ABSOLUTE(301,"查询路径不是绝对路径"),
    PATH_NO_FOLDER(302,"查询路径不是文件夹"),

    JURISDICTION_ERROR(501,"无权限访问"),
    DEFAULT_ERROR(502,"配置密码错误"),

    PARAMETER_ERROR(401,"参数异常"),
    SERVICE_NAME_ERROR(402,"服务名错误"),

    UNKOWN_ERROR(-1, "未知错误"),
    OK(200, "成功"),
    SUCCESS(0, "成功")
    ;

    private Integer code;
    private String msg;

    ResultEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public JSONObject getResult(){
        JSONObject res = new JSONObject();
        res.put("code",code);
        res.put("msg",msg);
        return res;
    }
}
